package com.woniuxy.hrp.provider;

import com.woniuxy.hrp.entity.Department;
import org.apache.ibatis.jdbc.SQL;

public class DepartmentSqlProvider {
    //修改医院信息动态SQL
    public static String updateDepartmentByCondition(Department department){
        String sql = new SQL(){
            {
                UPDATE("hrp_department");
                if (department.getName() != null){
                    SET("name=#{name}");
                }
                if (department.getAddress() != null){
                    SET("address=#{address}");
                }
                if (department.getDescription() != null){
                    SET("description=#{description}");
                }
                WHERE("id=#{id}");
            }
        }.toString();
        return sql;
    }
}
